﻿@inherits SysUserProfile

<GridRow>
	<GridCol Span="4">
		<div style="padding:10px;">
            <div class="avatar"><img src="@CurrentUser?.AvatarUrl" /></div>
            <ul class="userInfo">
                <li>
                    <Icon Type="user" Theme="outline" />
                    <span>@($"{User?.Name}({User?.UserName})")</span>
                </li>
                <li>
                    <Icon Type="phone" Theme="outline" />
                    <span>@User?.Phone</span>
                </li>
                <li>
                    <Icon Type="mobile" Theme="outline" />
                    <span>@User?.Mobile</span>
                </li>
                <li>
                    <Icon Type="inbox" Theme="outline" />
                    <span>@User?.Email</span>
                </li>
                <li>
                    <Icon Type="team" Theme="outline" />
                    <span>@User?.Role</span>
                </li>
                <li>
                    <Icon Type="comment" Theme="outline" />
                    <span>@User?.Note</span>
                </li>
            </ul>
		</div>
	</GridCol>
	<GridCol Span="20">
        <Tabs Animated>
            @* @if (Config.App.Type == AppType.Web)
            {
                <TabPane Tab="待办事项" Key="1">

                </TabPane>
                <TabPane Tab="我的消息" Key="2">

                </TabPane>
            } *@
            <TabPane Tab="我的信息" Key="3">
                <Form Model="@User" LabelColSpan="@labelCol" WrapperColSpan="@valueCol">
                    <FormItem Label="用户名">
                        @context.UserName
                    </FormItem>
                    <FormItem>
                        <Input @bind-Value="@context.Name" Disabled="@(!IsEdit)" />
                    </FormItem>
                    <FormItem>
                        <Input @bind-Value="@context.EnglishName" Disabled="@(!IsEdit)" />
                    </FormItem>
                    <FormItem>
                        <RadioGroup @bind-Value="@context.Gender" Disabled="@(!IsEdit)">
                            <Radio Value="@("男")">男</Radio>
                            <Radio Value="@("女")">女</Radio>
                        </RadioGroup>
                    </FormItem>
                    <FormItem>
                        <Input @bind-Value="@context.Phone" Disabled="@(!IsEdit)" />
                    </FormItem>
                    <FormItem>
                        <Input @bind-Value="@context.Mobile" Disabled="@(!IsEdit)" />
                    </FormItem>
                    <FormItem>
                        <Input @bind-Value="@context.Email" Disabled="@(!IsEdit)" />
                    </FormItem>
                    <FormItem Label="角色">
                        @context.Role
                    </FormItem>
                    <FormItem>
                        <TextArea @bind-Value="@context.Note" Disabled="@(!IsEdit)" />
                    </FormItem>
                    <FormItem WrapperColOffset="labelCol" WrapperColSpan="valueCol">
                        @if (!IsEdit)
                        {
                            <Button Type="@ButtonType.Primary" OnClick="e=>OnEdit(true)">编辑</Button>
                        }
                        else
                        {
                            <Button Type="@ButtonType.Primary" OnClick="e=>OnSaveUserInfo()">保存</Button>
                            <Button Type="@ButtonType.Default" OnClick="e=>OnEdit(false)">取消</Button>
                        }
                    </FormItem>
                </Form>
            </TabPane>
            <TabPane Tab="安全设置" Key="4">
                <Form Model="@PwdModel" OnFinish="OnSavePassword" LabelColSpan="@labelCol" WrapperColSpan="@valueCol">
                    <FormItem>
                        <InputPassword @bind-Value="context.OldPwd" />
                    </FormItem>
                    <FormItem>
                        <InputPassword @bind-Value="context.NewPwd" />
                    </FormItem>
                    <FormItem>
                        <InputPassword @bind-Value="context.NewPwd1" />
                    </FormItem>
                    <FormItem WrapperColOffset="labelCol" WrapperColSpan="valueCol">
                        <Button Type="@ButtonType.Primary" HtmlType="submit">确定修改</Button>
                    </FormItem>
                </Form>
            </TabPane>
        </Tabs>
	</GridCol>
</GridRow>

@code {
    private int labelCol = 4;
    private int valueCol = 8;
}